package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {
    //根据分类id查询套餐的个数
    @Select("select count(*) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    //新增操作
    @AutoFill(value = OperationType.INSERT)
    void insert(Setmeal setMeal);

    List<SetmealVO> queryByPage(SetmealPageQueryDTO setmealPageQueryDTO);

    void update(Setmeal setmeal);

    @Select("select * from setmeal where id = #{id}")
    Setmeal queryById(Long id);

    void deleteByIds(List<Long> ids);

    @Select("Select * from setmeal where category_id = #{categoryId} and status = 1")
    List<Setmeal> queryByCategoryId(Long categoryId);

    @Select("select count(id) from setmeal where status = #{status}")
    Integer getSetmealCount(Integer status);
}
